# Tanım: Yüksek performanslı bir derleyici (Steel Bank Common Lisp)
# URL: http://www.sbcl.org/
# Paketçi: milisarge
# Gerekler: clisp
# Grup: geliştirme

isim=sbcl
surum=1.3.17
devir=1
kaynak=(https://downloads.sourceforge.net/project/sbcl/sbcl/1.3.17/sbcl-$surum-source.tar.bz2
		arch-fixes.lisp
		customize-target-features.lisp)

derle() {
  cd "$SRC/$isim-$surum"
  export CFLAGS+=" -D_GNU_SOURCE -fno-omit-frame-pointer -DSBCL_HOME=/usr/lib/sbcl"
  export GNUMAKE="make"
  # build system uses LINKFLAGS and OS_LIBS to build LDFLAGS
  export LINKFLAGS="$LDFLAGS"
  unset LDFLAGS
  unset MAKEFLAGS
  enable_disable_largefile=enable
  # Make a multi-threaded SBCL, disable LARGEFILE
  #cp $SRC/customize-target-features.lisp .
  bash make.sh clisp --prefix=/usr --fancy

  # cannot have both SBCL_HOME and INSTALL_ROOT

  SBCL_HOME="" INSTALL_ROOT="$PKG/usr" sh install.sh

  src/runtime/sbcl --core output/sbcl.core --script "${SRC}/arch-fixes.lisp"

  mv sbcl-new.core "${PKG}/usr/lib/sbcl/sbcl.core"

  # sources

  mkdir -p "$PKG/usr/share/sbcl-source"

  cp -R -t "$PKG/usr/share/sbcl-source" "$SRC/$isim-$surum/"{src,contrib}

  # license

  install -D -m644 "$SRC/$isim-$surum/COPYING"  "$PKG/usr/share/licenses/$isim/license.txt"

  # drop unwanted files

  find "$PKG" \( -name Makefile -o -name .cvsignore \) -delete

  find "$PKG/usr/share/sbcl-source" -type f \( -name \*.fasl -o -name \*.o -o -name \*.log -o -name \*.so -o -name a.out \) -delete

  rm "$PKG/usr/share/sbcl-source/src/runtime/sbcl"{,.nm}

}
